From: Jonas Dreßler Date: Mon, 31 Jan 2022 22:40:39 +0000 (+0100) Subject: status/bluetooth: Bail out and hide UI when there's no adapter X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~516^2^2~69 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=aaf47167b5bb2a4ac15e2cdfdfcac71498dcd7c7;p=gnome-shell.git status/bluetooth: Bail out and hide UI when there's no adapter While _sync() does already handle the case where there's no adapter just fine (hiding the item and the indicator), let's make the handling a bit more obvious and add an explicit check for !this._adapter where we bail out and hide the UI. Part-of: --- diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index a7768c824..d84bc3ad5 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -130,13 +130,20 @@ class Indicator extends PanelMenu.SystemIndicator { } _sync() { - let devices = this._getDeviceInfos(); + const adapterJustAppeared = !this._adapter && this._client.default_adapter; + this._adapter = this._client.default_adapter ?? null; + if (!this._adapter) { + this._item.visible = false; + this._indicator.visible = false; + return; + } + + const devices = this._getDeviceInfos(); const connectedDevices = devices.filter(dev => dev.connected); const nConnectedDevices = connectedDevices.length; - if (this._client.default_adapter && this._adapter) + if (!adapterJustAppeared) this._setHadSetupDevices(devices.length > 0); - this._adapter = this._client.default_adapter ?? null; let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;